#pragma once
#include <odb/mysql/database.hxx>

class ODBFactory {
public:
    static std::shared_ptr<odb::core::database> create(const std::string& user,
                                                        const std::string& password,
                                                        const std::string& db,
                                                        const std::string& host = "127.0.0.1",
                                                        unsigned short port = 3306,
                                                        const std::string& charset = "utf8",
                                                        size_t max_pool_size = 3) {
        std::unique_ptr<odb::mysql::connection_pool_factory> pool_factory
        (
            std::make_unique<odb::mysql::connection_pool_factory>(max_pool_size, 0)
        );
        return std::make_shared<odb::mysql::database>(
            user,
            password,
            db,
            host,
            port,
            "",
            charset,
            0,
            std::move(pool_factory)
        );
    }

};
